<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'productList.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<style type="text/css">
#mytable{
border-collapse: collapse;
}
#mytable td, th{
	/* background: #fff; */
     font-size: 14px;
	padding: 2px 2px 2px 4px;
	color: #4f6b72; 
	border: 2px solid #C1DAD7;
	
}
</style>
	</head>
<script type="text/javascript">
   function checkInfo(id){
      window.location.href="showProductById?productId="+id;
   }
   function toShtml(id){
      $.post("htmlJson",{"productId":id},function(data){
         if(data.msg=='success'){
            alert("shtml页面生成成功");
         }else{
            alert("生成失败");
         }
      });
   }
</script>
	<body>
	<input type="button" value="生成全部shtml文件" onclick="toShtml(${p.productId })"/>
		<table id="mytable" style="margin-top: 30px;text-align: center;">
			<tr>
				<th>产品ID</th><th>产品名</th><th>产品字号</th><th>别名</th><th>详细信息修改</th>
			</tr>
			
				<c:forEach items="${products}" var="p">
				<tr>
				  <td>${p.productId }</td>
				  <td>${p.productName }</td>
				  <td>${p.productSize }</td>
				  <td>${p.alias }</td>
				  <td><input type="button" value="详细信息" onclick="checkInfo(${p.productId })"/></td>
				  <td><input type="button" value="生成shtml文件" onclick="toShtml(${p.productId })"/></td>
				  </tr>
				</c:forEach>
			
		</table>
	</body>
</html>
